<?php

namespace app\common\validate;

use think\Validate;

class FeedbackValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...].
     *
     * @var array
     */
    protected $rule = [
        'id|编号' => 'require|number|gt:0',
        'url|链接地址' => 'require|url',
        'name|链接名称' => 'min:2',
        'sort|排序' => 'require|number|gt:0',
        'page|页数' => 'require|number|gt:0',
        'limit|分页大小' => 'require|number|gt:5',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'.
     *
     * @var array
     */
    protected $message = [];
    protected $scene = [
        'getListPage' => ['page', 'limit'],
        'saveAdd' => ['url', 'name', 'sort'],
        'saveAdd' => ['url', 'name', 'sort'],
        'saveEdit' => ['id'],
        'getRow' => ['id'],
    ];
}
